package bb.lanxing.chart.custom;

import com.github.mikephil.charting.components.XAxis;
import com.github.mikephil.charting.data.BarEntry;
import com.github.mikephil.charting.interfaces.datasets.IBarDataSet;
import com.github.mikephil.charting.renderer.XAxisRenderer;
import com.github.mikephil.charting.utils.Transformer;
import com.github.mikephil.charting.utils.ViewPortHandler;
import java.util.ArrayList;

public class BarXAxisRenderer extends XAxisRenderer {
    private IBarDataSet barDataSet;

    public BarXAxisRenderer(ViewPortHandler viewPortHandler, XAxis xAxis, Transformer transformer) {
        super(viewPortHandler, xAxis, transformer);
    }

    public void setBarDataSet(IBarDataSet iBarDataSet) {
        this.barDataSet = iBarDataSet;
    }

    @Override
    public void computeAxisValues(float f, float f2) {
        super.computeAxisValues(f, f2);
        IBarDataSet iBarDataSet = this.barDataSet;
        if (iBarDataSet != null) {
            int entryCount = iBarDataSet.getEntryCount();
            ArrayList arrayList = new ArrayList();
            for (int i = 0; i < entryCount; i++) {
                float x = ((BarEntry) this.barDataSet.getEntryForIndex(i)).getX();
                if (x >= f && x <= f2) {
                    arrayList.add(x);
                }
            }
            int size = arrayList.size();
            this.mAxis.mEntries = new float[size];
            for (int i2 = 0; i2 < size; i2++) {
                this.mAxis.mEntries[i2] = (Float) arrayList.get(i2);
            }
            this.mAxis.mEntryCount = size;
        }
    }
}
